package com.cndw.kungfu.dao;

import java.util.Map;

import com.cndw.dao.jade.Identity;
import com.cndw.dao.jade.annotation.DAO;
import com.cndw.dao.jade.annotation.SQL;
import com.cndw.dao.jade.annotation.SQLParam;
import com.cndw.kungfu.model.disciple.domain.Disciple;
import com.cndw.kungfu.model.disciple.domain.DiscipleMode;

/**
 * 玩家徒弟数据库操作接口
 * @author fantadust [9677889@qq.com]
 * @date 2011-6-17 下午04:19:07
 */
@DAO
public interface DiscipleDao {

	
	public static final String TABLE = " kf_player_disciple ";
	
	public static final String FIELDS = " id,playerId,discipleId,name,icon,quality,growth,level,exp," +
			"power,physical,agile,wit,powerPercent,physicalPercent,agilePercent,witPercent," +
			"powerAdd,physicalAdd,agileAdd,witAdd," +
			"intimate,score,featureType,featureLevel,dower,createTime,campId,workId,position,devilTimes,gestSign,lastSysHandle";
	
		
	public static final String TABLE_MODE = "kfsys_disciple";
	
	public static final String FIELDS_MODE = "id,name,quality,growthMin,growthMax,reinGrowthMax,qualifiedType,qualifiedFloating";
	

	@SQL("select "+FIELDS+" from "+TABLE+" where playerId=:1 order by id asc ")
	public Map<Integer, Disciple> select(long  playerId);
	
	
	@SQL("select "+FIELDS_MODE+" from "+TABLE_MODE+" order by id asc ")
	public Map<Integer, DiscipleMode> getDiscipleModeMap();
	
	@SQL("Update "+TABLE+" set discipleId=:p.discipleId,name=:p.name,icon=:p.icon,quality=:p.quality,growth=:p.growth,level=:p.level,exp=:p.exp,power=:p.power,physical=:p.physical,agile=:p.agile,wit=:p.wit,powerPercent=:p.powerPercent,physicalPercent=:p.physicalPercent,agilePercent=:p.agilePercent,witPercent=:p.witPercent,powerAdd=:p.powerAdd,physicalAdd=:p.physicalAdd,agileAdd=:p.agileAdd,witAdd=:p.witAdd,intimate=:p.intimate,score=:p.score,featureType=:p.featureType,featureLevel=:p.featureLevel,dower=:p.dower,createTime=:p.createTime,campId=:p.campId,workId=:p.workId,position=:p.position,devilTimes=:p.devilTimes,gestSign=:p.gestSign,lastSysHandle=:p.lastSysHandle where id=:p.id")
	public int update(@SQLParam("p") Disciple disciple);

	
	@SQL("INSERT INTO "+TABLE+" ("+FIELDS+") VALUES (:p.id,:p.playerId,:p.discipleId,:p.name,:p.icon,:p.quality,:p.growth,:p.level,:p.exp,:p.power,:p.physical,:p.agile,:p.wit,:p.powerPercent,:p.physicalPercent,:p.agilePercent,:p.witPercent,:p.powerAdd,:p.physicalAdd,:p.agileAdd,:p.witAdd,:p.intimate,:p.score,:p.featureType,:p.featureLevel,:p.dower,:p.createTime,:p.campId,:p.workId,:p.position,:p.devilTimes,:p.gestSign,:p.lastSysHandle)  ")
	public Identity insert(@SQLParam("p") Disciple disciple);

	@SQL("delete from "+TABLE+" where id=:1 ")
	public void delete(int id);
	
}
